﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>黑名单用户查询查询</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiAdmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiAdmin/style/admin.css" media="all">
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <input type="text" name="name" placeholder="请输入用户名、身份证号或手机号" autocomplete="new-password" style="width:300px"
                               class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-useradmin" layadmin-event="reset">
                            <i class="layui-icon layui-icon-refresh layuiadmin-button-btn"></i>
                        </button>
                        <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="form-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                    <div class="layui-inline" style="float: right;">
                        <button class="layui-btn" id="set-blacklist">
                            设为黑名单
                        </button>
                    </div>
                </div>
            </div>
            <div class="layui-card-body">
                <table id="usersearch-manage" lay-filter="usersearch-manage"></table>
            </div>
        </div>
    </div>
    <script src="../../layuiAdmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: '../../layuiAdmin/', //静态资源所在路径
            version: top.layui.setter.version
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'table'], function () {
            var $ = layui.$,
                form = layui.form,
                table = layui.table

            window.areaName = "usersearch-manage";
            var field = {};
            //监听搜索
            form.on('submit(form-search)', function (data) {
                field = data.field;
                //执行重载
                table.reload(areaName, {
                    where: { queryJson: JSON.stringify(field) },
                    page: {
                        curr: 1
                    }
                });
            });
           
            //管理
            table.render({
                elem: '#' + areaName,
                url: '/api/User/GetUserPageList',
                cols: [
                    [
                        { field: 'number', title: '序号', width: 80, align: 'center', type: 'numbers' },
                        { field: 'cUserName', title: '账号', minWidth: 80 },
                        { field: 'cName', title: '用户名', minWidth: 100 },
                        { field: 'cLastLoginTime', title: '最后登录时间', align: 'center', width: 160 },
                    ]
                ],
                page: true,
                limit: 20,
                height: 'full-110',
                text: '对不起，加载出现异常！'
            });
            var selectRow = null;
            table.on('row(' + areaName + ')', function (obj) {
                selectRow = obj.data;
                obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
            });


            $("#set-blacklist").click(function () {
                if (selectRow == null) {
                    return layer.msg('请选择数据');
                }
                $.OpenTab({
                    type: 2,
                    title: '设置黑名单',
                    content: `blacklistform.html?cUserName=${selectRow.cUserName}&cUserId=${selectRow.cId}`,
                    area: ['860px', '450px'],
                    btn: ['确定', '取消']
                });
            })
        });
    </script>
</body>

</html>